package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpInventoryRequisitionDashboardPageUtil extends SeleniumPageUtil {

	public final static By IRD_TD_PAGE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[1]");
	public final static By IRD_SPAN_PAGE_START_NO = By.id("ctl44_RequisitionsDashboard_PagingTop_lblPagingPageNumber");
	public final static By IRD_TD_OF = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[3]");
	public final static By IRD_SPAN_PAGE_COUNT = By.id("ctl44_RequisitionsDashboard_PagingTop_lblPagingPageCount");
	
	public final static By IRD_INPUT_FIRST = By.id("ctl44_RequisitionsDashboard_PagingTop_imgFirst");
	public final static By IRD_INPUT_PREVIOUS = By.id("ctl44_RequisitionsDashboard_PagingTop_imgPrevious");
	public final static By IRD_INPUT_NEXT = By.id("ctl44_RequisitionsDashboard_PagingTop_imgNext");
	public final static By IRD_INPUT_LAST = By.id("ctl44_RequisitionsDashboard_PagingTop_imgLast");
	
	public final static By IRD_IMG_FILTER_1 = By.id("ctl44_RequisitionsDashboard_filter_1");
	public final static By IRD_IMG_FILTER_2 = By.id("ctl44_RequisitionsDashboard_filter_2");
	public final static By IRD_IMG_FILTER_3 = By.id("ctl44_RequisitionsDashboard_filter_3");
	public final static By IRD_IMG_FILTER_4 = By.id("ctl44_RequisitionsDashboard_filter_4");
	public final static By IRD_IMG_FILTER_5 = By.id("ctl44_RequisitionsDashboard_filter_5");
	public final static By IRD_IMG_FILTER_6 = By.id("ctl44_RequisitionsDashboard_filter_6");
	public final static By IRD_IMG_FILTER_7 = By.id("ctl44_RequisitionsDashboard_filter_7");
	public final static By IRD_IMG_FILTER_8 = By.id("ctl44_RequisitionsDashboard_filter_8");
	public final static By IRD_IMG_FILTER_9 = By.id("ctl44_RequisitionsDashboard_filter_9");
	public final static By IRD_IMG_FILTER_10 = By.id("ctl44_RequisitionsDashboard_filter_10");
	public final static By IRD_IMG_FILTER_11 = By.id("ctl44_RequisitionsDashboard_filter_11");
	public final static By IRD_IMG_FILTER_12 = By.id("ctl44_RequisitionsDashboard_filter_12");
	public final static By IRD_IMG_FILTER_13 = By.id("ctl44_RequisitionsDashboard_filter_13");
	
	public final static By IRD_TH_ITEM_NUMBER = By.id("ctl44_RequisitionsDashboard_sort_1");
	public final static By IRD_TH_REASON = By.id("ctl44_RequisitionsDashboard_sort_2");
	public final static By IRD_TH_REQUESTED_DATE = By.id("ctl44_RequisitionsDashboard_sort_3");
	public final static By IRD_TH_STATUS = By.id("ctl44_RequisitionsDashboard_sort_4");
	public final static By IRD_TH_QUANTITY = By.id("ctl44_RequisitionsDashboard_sort_5");
	public final static By IRD_TH_COST = By.id("ctl44_RequisitionsDashboard_sort_6");
	public final static By IRD_TH_DESCRIPTION = By.id("ctl44_RequisitionsDashboard_sort_7");
	public final static By IRD_TH_DESIRED_DATE = By.id("ctl44_RequisitionsDashboard_sort_8");
	public final static By IRD_TH_CUSTOMER = By.id("ctl44_RequisitionsDashboard_sort_9");
	public final static By IRD_TH_REQUISITION = By.id("ctl44_RequisitionsDashboard_sort_10");
	public final static By IRD_TH_REQUESTOR = By.id("ctl44_RequisitionsDashboard_sort_11");
	public final static By IRD_TH_WAREHOUSE = By.id("ctl44_RequisitionsDashboard_sort_12");
	public final static By IRD_TH_NEXT_APPROVER = By.id("ctl44_RequisitionsDashboard_sort_13");
	public final static By IRD_SPAN_RESULTS = By.id("ctl44_RequisitionsDashboard_ReportOutput");
	
	// elements of filter dialog
	public final static By IRD_INPUT_TEXT = By.id("ctl44_RequisitionsDashboard_txtFilterInput");
	public final static By IRD_INPUT_ENTER = By.id("ctl44_RequisitionsDashboard_btnFilterEnter");
	// elements of date filter dialog
	public final static By IRD_IMG_DATE = By.id("ctl44_RequisitionsDashboard_dtmFilterDate_imgDateCalendar");
	public final static By IRD_DIV_TODAY = By.id("ctl44_RequisitionsDashboard_dtmFilterDate_txtDatePart_CalendarExtender_today");
	
	//requisition results table
	public final static By IRD_REQUISI_ITEMS = By.id("ctl44_RequisitionsDashboard_ReportOutput");
	
	
	
	public static void enterInventoryReqDashboardPage() {
		SpHomePageUtil.enter();
		SpHomePageUtil.enterInventoryReqDashboardPage();
	}
	
	public static void waitForInventoryReqDashboardPageToLoad() {
		SeleniumUtil.waitForFixedMilliseconds(3000);
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				IRD_IMG_FILTER_1, IRD_IMG_FILTER_2, IRD_IMG_FILTER_3, IRD_IMG_FILTER_4, IRD_IMG_FILTER_5, IRD_IMG_FILTER_6, IRD_IMG_FILTER_7,
				IRD_IMG_FILTER_8, IRD_IMG_FILTER_9, IRD_IMG_FILTER_10, IRD_IMG_FILTER_11, IRD_IMG_FILTER_12, IRD_INPUT_FIRST, IRD_INPUT_PREVIOUS, 
				IRD_INPUT_NEXT,	IRD_INPUT_LAST, IRD_IMG_FILTER_13
			});
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_INPUT_FIRST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_INPUT_PREVIOUS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_INPUT_NEXT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_INPUT_LAST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_1));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_2));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_3));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_4));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_5));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_6));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_7));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_8));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_9));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_10));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_11));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_12));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRD_IMG_FILTER_13));
	}
	
}
